package com.yj.audio_output_device_new.util.permission;

import android.Manifest;
import android.app.Activity;
import android.content.Context;
import android.content.pm.PackageManager;
import android.os.Build;

import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;

import com.yj.audio_output_device_new.util.log.Log;

import java.lang.ref.WeakReference;

public class PermissionUtil {
    private static final String TAG = PermissionUtil.class.getSimpleName();

    public static boolean checkBleConnectPermission(@NonNull Context context){
        boolean flag = true;
        try {
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
                flag = ContextCompat.checkSelfPermission(context, Manifest.permission.BLUETOOTH_CONNECT) == PackageManager.PERMISSION_GRANTED;
            }
        }catch (Exception e){
            Log.e(TAG, e.getMessage());
            e.printStackTrace();
        }

        Log.d(TAG, "checkBleConnectPermission: "+flag);
        return flag;
    }

}
